package com.erdan.usercenter.once;
import java.util.Date;

import com.erdan.usercenter.mapper.UserMapper;
import com.erdan.usercenter.model.domain.User;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;

import javax.annotation.Resource;

@Component
public class InsertUsers {

    @Resource
    private UserMapper userMapper;

    /**
     * 批量插入用户
     */
//    @Scheduled(initialDelay = 1000, fixedDelay = Long.MAX_VALUE)
    public void donInsertUsers() {
        StopWatch stopWatch = new StopWatch();
        stopWatch.start();
        System.out.println("qqq");
//        final int INSERT_NUM = 10;
//        for (int i = 0; i < INSERT_NUM; i++) {
//            User user = new User();
//            user.setUsername("假二蛋");
//            user.setUserAccount("fakeyupi");
//            user.setAvatarUrl("https://gips3.baidu.com/it/u=1004796864,1363400944&fm=3039&app=3039&f=JPEG?w=1024&h=1024");
//            user.setGender(0);
//            user.setUserPassword("33b243878c087e18bb4b39ca94653cfb");
//            user.setPhone("12345678900");
//            user.setEmail("erdan@163.com");
//            user.setTags("[]");
//            user.setUserStatus(0);
//            user.setUserRole(0);
//            user.setPlanetCode((100+i) + "");
//            userMapper.insert(user);
//        }
        stopWatch.stop();
        System.out.println(stopWatch.getTotalTimeMillis());
    }

//    public static void main(String[] args) {
//        new InsertUsers().donInsertUsers();
//    }
}
